﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="IssuringOrderEditUserControl.ascx.cs"
    Inherits="NetDon.OA.Portal.Shunting.IssuringOrderEditUserControl" %>
<%@ Register TagPrefix="uc1" TagName="RequiredMark_1" Src="~/Controls/RequiredMark.ascx" %>
<%@ Import Namespace="NetDon.OA.Interface" %>
<%@ Import Namespace="NetDon.Utilities" %>
<%@ Register Src="../Controls/RequiredMark.ascx" TagName="RequiredMark" TagPrefix="uc1" %>
<%@ Register Src="../Components/MultipleProvinceCity.ascx" TagName="ComanyDepartment"
    TagPrefix="uc2" %>
<script language="javascript" type="text/javascript">
    function deleteIssuingOrderDeliveryId(issuingOrderDeliveryId) {
        $confirm("确定要删除该交货单信息吗？", function (result) {
            if (result == true) {
                $text($get('<%=hfdIssuingOrderDeliveryId.ClientID %>'), issuingOrderDeliveryId);
                $get('<%=btnIssuingOrderDeliveryDelete.ClientID %>').click();
            }
        });
    }


    function onChangeDeliveryCode(obj, foucsControlId, rowIndex) {
        var deliveryCode = $(obj).val();
        if (deliveryCode.trim() != "") {

            $text($get('<%=HiddenDeliveryCode.ClientID %>'), deliveryCode);
            $text($get('<%=HiddenRowIndex.ClientID %>'), rowIndex);

            setFocus(obj, foucsControlId);
            $get('<%=btnHiddenDeliveryCodeChanged.ClientID %>').click();

        }

    }

    function onChangeDeliveryCity(obj, foucsControlId, rowIndex) {
        var deliveryCity = $(obj).val();
        if (deliveryCity.trim() != "") {

            $text($get('<%=HiddenDeliveryCity.ClientID %>'), deliveryCity);
            $text($get('<%=HiddenRowIndex.ClientID %>'), rowIndex);

            setFocus(obj, foucsControlId);
            $get('<%=btnHiddenDeliveryCityChanged.ClientID %>').click();

        }

    }
    


</script>
<table style="width: 100%; height: 100%" cellpadding="0" cellspacing="0">
    <tr>
        <td>
            <NetDon:FormPanel ID="FormPanelBusinessType" runat="server" CaptionAlign="NotSet"
                RepeatColumns="2">
                <Items>
                    <NetDon:FormItem FullRow="True" HeaderVisible="False">
                        <ContentTemplate>
                            <asp:Literal ID="Literal4" runat="server" Text="业务类型"></asp:Literal>
                        </ContentTemplate>
                    </NetDon:FormItem>
                    <NetDon:FormItem HeaderText="当前业务类型" Key="FormItemBusinessTypeViewMode">
                        <ContentTemplate>
                            <asp:Label ID="lblBusinessType" runat="server">
                            </asp:Label>
                        </ContentTemplate>
                    </NetDon:FormItem>
                    <NetDon:FormItem HeaderText="请选择" Key="FormItemBusinessTypeEditMode">
                        <ContentTemplate>
                            <asp:RadioButton runat="server" AutoPostBack="True" Text="A" GroupName="BusinessType"
                                ID="radioBusinesTypeA" OnCheckedChanged="radioBusinesType_CheckedChanged" />
                            <asp:RadioButton runat="server" AutoPostBack="True" Text="B" GroupName="BusinessType"
                                ID="radioBusinesTypeB" OnCheckedChanged="radioBusinesType_CheckedChanged" />
                            <uc1:RequiredMark_1 ID="RequiredMark_1" runat="server" />
                        </ContentTemplate>
                    </NetDon:FormItem>
                </Items>
            </NetDon:FormPanel>
        </td>
    </tr>
    <tr>
        <td>
            <NetDon:FormPanel ID="FormPanelIssuringOrderInfo" runat="server" CaptionAlign="NotSet"
                RepeatColumns="2">
                <Items>
                    <NetDon:FormItem FullRow="True" HeaderVisible="False">
                        <ContentTemplate>
                            <asp:Literal ID="Literal2" runat="server" Text="回单信息"></asp:Literal>
                        </ContentTemplate>
                    </NetDon:FormItem>
                    <NetDon:FormItem HeaderText="订单编号" Key="orderCode">
                        <ContentTemplate>
                            <asp:Label runat="server" ID="txtOrderCode" Text='<%# Eval("OrderCode") %>'>	</asp:Label>
                        </ContentTemplate>
                    </NetDon:FormItem>
                    <NetDon:FormItem HeaderText="出单状态" Key="orderStatusItem">
                        <ContentTemplate>
                            <asp:Label runat="server" ID="txtOrderStatus" Text='<%# EnumUtilities.GetDescription((OrderStatus)Enum.Parse(typeof(OrderStatus), Eval("OrderStatus").ToString())) %>'>	</asp:Label>
                        </ContentTemplate>
                    </NetDon:FormItem>
                    <NetDon:FormItem HeaderText="客户">
                        <ContentTemplate>
                            <asp:DropDownList ID="ddlCustomer" runat="server" DataSourceID="ObjectDataSourceCustomers"
                                DataTextField="CustomerName" DataValueField="CustomerId" AutoPostBack="True"
                                AppendDataBoundItems="true" OnSelectedIndexChanged="ddlCustomer_SelectedIndexChanged">
                            </asp:DropDownList>
                            <asp:ObjectDataSource ID="ObjectDataSourceCustomers" runat="server" OldValuesParameterFormatString="original_{0}"
                                SelectMethod="RetrieveCustomers" TypeName="NetDon.OA.Business.MiscDataSource">
                                <SelectParameters>
                                    <asp:Parameter Name="areaId" />
                                </SelectParameters>
                            </asp:ObjectDataSource>
                            <uc1:RequiredMark ID="RequiredMark2" runat="server" />
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="ddlCustomer"
                                Display="None" ErrorMessage="请选择客户" SetFocusOnError="True"></asp:RequiredFieldValidator>
                        </ContentTemplate>
                    </NetDon:FormItem>
                    <NetDon:FormItem HeaderText="承运货物">
                        <ContentTemplate>
                            <asp:DropDownList ID="ddlGoodsShippedTypeId" AppendDataBoundItems="True" runat="server"
                                DataTextField="Name" DataValueField="OID" OnSelectedIndexChanged="ddlGoodsShippedTypeId_SelectedIndexChanged"
                                AutoPostBack="True">
                            </asp:DropDownList>
                            <%--  <NetDon:DictionaryDataSource ID="ddsGoodsShippedTypeId" runat="server" CategoryName="承运货物"
                    EmptyItemType="Select">
                </NetDon:DictionaryDataSource>--%>
                            <uc1:RequiredMark ID="RequiredMark3" runat="server" />
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="ddlGoodsShippedTypeId"
                                Display="None" ErrorMessage="请选择承运货物" SetFocusOnError="True"></asp:RequiredFieldValidator>
                        </ContentTemplate>
                    </NetDon:FormItem>
                    <NetDon:FormItem HeaderText="线路分类">
                        <ContentTemplate>
                            <asp:DropDownList ID="ddlRouteTypeId" DataSourceID="ddsRouteTypeId" AppendDataBoundItems="true"
                                runat="server" DataTextField="Name" DataValueField="Value">
                            </asp:DropDownList>
                            <NetDon:DictionaryDataSource ID="ddsRouteTypeId" runat="server" CategoryName="线路分类"
                                EmptyItemType="Select">
                            </NetDon:DictionaryDataSource>
                            <uc1:RequiredMark ID="RequiredMark11" runat="server" />
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator11" runat="server" ControlToValidate="ddlRouteTypeId"
                                Display="None" ErrorMessage="请选择线路分类" SetFocusOnError="True">
                            </asp:RequiredFieldValidator>
                        </ContentTemplate>
                    </NetDon:FormItem>
                    <NetDon:FormItem HeaderText="出单日期">
                        <ContentTemplate>
                            <asp:TextBox ID="txtReceivingOrderDate" Text='<%#Eval("ReceivingOrderDate") != null ? ((DateTime)Eval("ReceivingOrderDate")).ToString("yyyy-MM-dd") : ""%>'
                                runat="server"></asp:TextBox>
                            <uc1:RequiredMark ID="RequiredMark4" runat="server" />
                            <%-- <asp:MaskedEditExtender ID="txtReceivingOrderDateMaskedEditExtender1" runat="server"
                    ClearTextOnInvalid="True" ClipboardEnabled="False" CultureAMPMPlaceholder=""
                    CultureCurrencySymbolPlaceholder="" CultureDateFormat="YMD" CultureDatePlaceholder=""
                    CultureDecimalPlaceholder="" CultureThousandsPlaceholder="" CultureTimePlaceholder=""
                    Enabled="True" MaskType="Date" TargetControlID="txtReceivingOrderDate" UserDateFormat="YearMonthDay"
                    Mask="9999-99-99" Century="2000">
                </asp:MaskedEditExtender>--%>
                            <asp:CalendarExtender ID="txtReceivingOrderDateCalendarExtender1" runat="server"
                                Animated="False" Enabled="True" FirstDayOfWeek="Sunday" TargetControlID="txtReceivingOrderDate"
                                Format="yyyy-MM-dd">
                            </asp:CalendarExtender>
                            <asp:CustomValidator ID="txtReceivingOrderDateCustomValidator1" ClientValidationFunction="validateDateText"
                                runat="server" ErrorMessage="出单日期无效." Display="None" ControlToValidate="txtReceivingOrderDate"
                                OnServerValidate="DateValidator_ServerValidate"></asp:CustomValidator>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtReceivingOrderDate"
                                Display="None" ErrorMessage="请输入出单日期" SetFocusOnError="True"></asp:RequiredFieldValidator>
                        </ContentTemplate>
                    </NetDon:FormItem>
                    <NetDon:FormItem HeaderText="运输计划号">
                        <ContentTemplate>
                            <asp:TextBox ID="txtTransportationPlanCode" Text='<%#Bind("TransportationPlanCode") %>'
                                runat="server" MaxLength="50"></asp:TextBox>
                            <uc1:RequiredMark ID="RequiredMark6" runat="server" />
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="txtTransportationPlanCode"
                                Display="None" ErrorMessage="请输入运输计划号" SetFocusOnError="True"></asp:RequiredFieldValidator>
                        </ContentTemplate>
                    </NetDon:FormItem>
                    <NetDon:FormItem HeaderText="结算方式">
                        <ContentTemplate>
                            <asp:DropDownList ID="ddlCheckoutType" runat="server" DataSourceID="EnumDataSourceCheckoutType"
                                DataTextField="Description" DataValueField="Name" AutoPostBack="True" OnSelectedIndexChanged="ddlCheckoutType_SelectedIndexChanged">
                            </asp:DropDownList>
                            <NetDon:EnumDataSource ID="EnumDataSourceCheckoutType" EmptyItemType="All" runat="server"
                                TypeName="NetDon.OA.Interface.CheckoutType">
                            </NetDon:EnumDataSource>
                            <uc1:RequiredMark ID="RequiredMark8" runat="server" />
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ControlToValidate="ddlCheckoutType"
                                Display="None" ErrorMessage="请选择结算方式" SetFocusOnError="True"></asp:RequiredFieldValidator>
                        </ContentTemplate>
                    </NetDon:FormItem>
                    <NetDon:FormItem HeaderText="下单车数">
                        <ContentTemplate>
                            <asp:TextBox ID="txtOrderVehicleNumber" Text='<%#Eval("OrderVehicleNumber") %>' runat="server"></asp:TextBox>
                            <uc1:RequiredMark ID="RequiredMark5" runat="server" />
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="txtOrderVehicleNumber"
                                Display="None" ErrorMessage="请输入下单车数" SetFocusOnError="True"></asp:RequiredFieldValidator>
                            <NetDon:NumericEditExtender ID="NumericEditExtender3" runat="server" MaxValue="100000"
                                TargetControlID="txtOrderVehicleNumber" DataMode="Integer">
                            </NetDon:NumericEditExtender>
                        </ContentTemplate>
                    </NetDon:FormItem>
                    <NetDon:FormItem HeaderText="装货地点">
                        <ContentTemplate>
                            <asp:DropDownList ID="ddlEntruckingAddress" DataSourceID="ddsEntruckingAddress" AppendDataBoundItems="True"
                                runat="server" DataTextField="Name" DataValueField="Value">
                            </asp:DropDownList>
                            <NetDon:DictionaryDataSource ID="ddsEntruckingAddress" runat="server" CategoryName="装货地点"
                                EmptyItemType="Select">
                            </NetDon:DictionaryDataSource>
                            <uc1:RequiredMark ID="RequiredMark7" runat="server" />
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ControlToValidate="ddlEntruckingAddress"
                                Display="None" ErrorMessage="请输入装货地点" SetFocusOnError="True"></asp:RequiredFieldValidator>
                        </ContentTemplate>
                    </NetDon:FormItem>
                    <NetDon:FormItem HeaderText="送货省份">
                        <ContentTemplate>
                            <asp:DropDownList ID="ddlProvince" runat="server" AppendDataBoundItems="true" DataTextField="Name"
                                DataValueField="Code" AutoPostBack="true" OnSelectedIndexChanged="ddlProvince_SelectedIndexChanged">
                            </asp:DropDownList>
                            <uc1:RequiredMark ID="RequiredMark1" runat="server" />
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="ddlProvince"
                                Display="None" ErrorMessage="请选择送货省份" SetFocusOnError="True"></asp:RequiredFieldValidator>
                        </ContentTemplate>
                    </NetDon:FormItem>
                    <NetDon:FormItem HeaderText="下单材积（方）">
                        <ContentTemplate>
                            <asp:Label ID="lblOrdeVolumn" Text='<%#Convert.ToDecimal(Eval("OrderVolumn")).ToString("#,###.000")%>'
                                runat="server" SkinID="Text80" Style="text-align: right"></asp:Label>
                        </ContentTemplate>
                    </NetDon:FormItem>
                    <NetDon:FormItem HeaderText="下单重量（吨）">
                        <ContentTemplate>
                            <asp:Label ID="lblOrderWeight" Text='<%#Convert.ToDecimal(Eval("OrderWeight")).ToString("#,###.000")%>'
                                runat="server" SkinID="Text80" Style="text-align: right"></asp:Label>
                        </ContentTemplate>
                    </NetDon:FormItem>
                    <NetDon:FormItem HeaderText="下单数量" ColumnSpan="2">
                        <ContentTemplate>
                            <asp:Label ID="lblOrderQuantity" Text='<%#Convert.ToDecimal(Eval("OrderQuantity")).ToString("#,###.00")%>'
                                runat="server" SkinID="Text80" Style="text-align: right"></asp:Label>
                        </ContentTemplate>
                    </NetDon:FormItem>
                    <NetDon:FormItem HeaderText="客户要求（地点）" ColumnSpan="2">
                        <ContentTemplate>
                            <asp:TextBox ID="txtEntruckingDetails" runat="server" Text='<%#Bind("EntruckingDetails") %>'
                                Width="450px" TextMode="MultiLine" Height="100px"></asp:TextBox>
                        </ContentTemplate>
                    </NetDon:FormItem>
                    <NetDon:FormItem FullRow="True" HeaderVisible="False">
                        <ContentTemplate>
                            <asp:Literal ID="Literal3" runat="server" Text="交货单信息"></asp:Literal>
                        </ContentTemplate>
                    </NetDon:FormItem>
                </Items>
            </NetDon:FormPanel>
        </td>
    </tr>
    <tr>
        <td>
            <NetDon:FormPanel ID="FormPanelIssuingOrderDelivery" runat="server" CaptionAlign="NotSet">
                <Items>
                    <NetDon:FormItem HeaderText="" Key="issuingOrderDelivery">
                        <ContentTemplate>
                            <NetDon:GridView ID="gridOrderDetailList" runat="server" AutoGenerateColumns="False"
                                OnRowDataBound="gridIssuingOrderDelivery_RowDataBound" DataKeyNames="Id" CssClass="IncrementalTable"
                                Width="300px">
                                <Columns>
                                    <NetDon:IndexField HeaderText="序号">
                                    </NetDon:IndexField>
                                    <NetDon:TemplateField HeaderText="交货单类型">
                                        <ItemTemplate>
                                            <asp:DropDownList ID="ddlDeliveryCodeType" DataSourceID="ddsDeliveryCodeType" AppendDataBoundItems="true"
                                                runat="server" DataTextField="Name" DataValueField="Value" Width="90px">
                                            </asp:DropDownList>
                                            <NetDon:DictionaryDataSource ID="ddsDeliveryCodeType" runat="server" CategoryName="交货单类型"
                                                EmptyItemType="Select">
                                            </NetDon:DictionaryDataSource>
                                            <br />
                                        </ItemTemplate>
                                    </NetDon:TemplateField>
                                    <NetDon:TemplateField HeaderText="交货单号">
                                        <ItemTemplate>
                                            <asp:TextBox ID="txtDeliveryOrderCode" Text='<%#Eval("DeliveryOrderCode")%>' MaxLength="50"
                                                Width="90px" runat="server"></asp:TextBox>
                                            <br />
                                        </ItemTemplate>
                                    </NetDon:TemplateField>
                                    <NetDon:TemplateField HeaderText="下单数量">
                                        <ItemTemplate>
                                            <asp:TextBox ID="txtOrderQuantity" Text='<%#Convert.ToDecimal(Eval("OrderQuantity")).ToString("#,###.00")%>'
                                                runat="server" SkinID="Text50" Style="text-align: right"></asp:TextBox>
                                            <NetDon:NumericEditExtender ID="NumericEditExtender14" runat="server" MaxValue="100000"
                                                TargetControlID="txtOrderQuantity" DataMode="Double">
                                            </NetDon:NumericEditExtender>
                                        </ItemTemplate>
                                    </NetDon:TemplateField>
                                    <NetDon:TemplateField HeaderText="下单材积<Br/>（方）">
                                        <ItemTemplate>
                                            <asp:TextBox ID="txtOrderVolumn" Text='<%#Convert.ToDecimal(Eval("OrderVolumn")).ToString("#,###.000")%>'
                                                runat="server" SkinID="Text50" Style="text-align: right"></asp:TextBox>
                                            <NetDon:NumericEditExtender ID="NumericEditExtender1" runat="server" TargetControlID="txtOrderVolumn"
                                                DataMode="Double">
                                            </NetDon:NumericEditExtender>
                                        </ItemTemplate>
                                    </NetDon:TemplateField>
                                    <NetDon:TemplateField HeaderText="下单重量<Br/>（吨）">
                                        <ItemTemplate>
                                            <asp:TextBox ID="txtOrderWeight" Text='<%#Convert.ToDecimal(Eval("OrderWeight")).ToString("#,###.000")%>'
                                                runat="server" SkinID="Text50" Style="text-align: right"></asp:TextBox>
                                            <NetDon:NumericEditExtender ID="NumericEditExtender2" runat="server" TargetControlID="txtOrderWeight"
                                                DataMode="Double">
                                            </NetDon:NumericEditExtender>
                                        </ItemTemplate>
                                    </NetDon:TemplateField>
                                    <NetDon:TemplateField HeaderText="送货城市">
                                        <ItemTemplate>
                                            <asp:DropDownList ID="ddlCity" runat="server" AppendDataBoundItems="true" DataTextField="Name"
                                                DataValueField="Code" Width="80px">
                                            </asp:DropDownList>
                                        </ItemTemplate>
                                    </NetDon:TemplateField>
                                    <NetDon:TemplateField HeaderText="送货地址">
                                        <ItemTemplate>
                                            <asp:TextBox ID="txtDeliveryAddress" runat="server" Text='<%#Bind("DeliveryAddress") %>'
                                                Width="150px" MaxLength="250" TextMode="MultiLine" Height="40px"></asp:TextBox>
                                            <asp:AutoCompleteExtender ID="AutoCompleteExtender1" TargetControlID="txtDeliveryAddress"
                                                MinimumPrefixLength="3" CompletionSetCount="20" ServicePath="~/CascadingService.asmx"
                                                ServiceMethod="GetIssuingOrderAddress" runat="server" />
                                        </ItemTemplate>
                                    </NetDon:TemplateField>
                                    <NetDon:TemplateField HeaderText="成本单价">
                                        <ItemTemplate>
                                            <asp:TextBox ID="txtUnitCost" Text='<%#Convert.ToDecimal(Eval("UnitCost")).ToString("#,###.0000")%>'
                                                runat="server" SkinID="Text50" Style="text-align: right"></asp:TextBox>
                                            <NetDon:NumericEditExtender ID="NumericEditExtender4" runat="server" TargetControlID="txtUnitCost"
                                                DataMode="Double">
                                            </NetDon:NumericEditExtender>
                                        </ItemTemplate>
                                    </NetDon:TemplateField>
                                    <NetDon:TemplateField HeaderText="操作" ItemStyle-Width="30px">
                                        <ItemTemplate>
                                            <asp:ImageButton ID="btnDelete" runat="server" CausesValidation="false" SkinID="Delete" />
                                        </ItemTemplate>
                                    </NetDon:TemplateField>
                                </Columns>
                            </NetDon:GridView>
                        </ContentTemplate>
                    </NetDon:FormItem>
                </Items>
            </NetDon:FormPanel>
        </td>
    </tr>
</table>
<asp:HiddenField ID="hfdIssuingOrderDeliveryId" runat="server" />
<asp:HiddenField ID="HiddenFieldOrderStatus" runat="server" />
<asp:HiddenField ID="HiddenFieldTransportationPlanCode" runat="server" />
<asp:Button ID="btnIssuingOrderDeliveryDelete" runat="server" SkinID="Hidden" CausesValidation="false"
    OnClick="btnIssuingOrderDeliveryDelete_Click"></asp:Button>
<asp:Button ID="btnHiddenDeliveryCodeChanged" runat="server" SkinID="Hidden" CausesValidation="false"
    OnClick="txtDeliveryOrderCode_SelectedIndexChanged"></asp:Button>
<asp:HiddenField ID="HiddenDeliveryCode" runat="server" />
<asp:HiddenField ID="HiddenRowIndex" runat="server" />
<asp:HiddenField ID="hiddenAreaId" runat="server" Value="<%#CurrentApplicationContext.CompanyId %>" />
<asp:Button ID="btnHiddenDeliveryCityChanged" runat="server" SkinID="Hidden" CausesValidation="false"
    OnClick="txtDeliveryOrderCity_SelectedIndexChanged"></asp:Button>
<asp:HiddenField ID="HiddenDeliveryCity" runat="server" />
